<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="referrer" content="no-referrer">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>全网视频-解析工具</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 10px;
            color: #333;
        }

        .container {
            max-width: 900px;
            margin: 0 auto;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 15px;
        }

        h1 {
            text-align: center;
            color: #2d8cf0;
            margin-bottom: 20px;
            font-size: 24px;
        }

        .input-group {
            display: flex;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .input-group input {
            flex: 1;
            padding: 10px 15px;
            border: 1px solid #dcdee2;
            border-radius: 4px;
            font-size: 16px;
            outline: none;
            min-width: 200px;
            margin-bottom: 10px;
        }

        .input-group button {
            padding: 10px 20px;
            background-color: #2d8cf0;
            border: none;
            color: white;
            cursor: pointer;
            border-radius: 4px;
            font-size: 16px;
            transition: background-color 0.3s;
            width: 100%;
        }

        .input-group button:hover {
            background-color: #5cadff;
        }

        .player-container {
            width: 100%;
            margin-bottom: 20px;
            position: relative;
            padding-bottom: 56.25%;
            height: 0;
            overflow: hidden;
        }

        #video-player {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;
        }

        .api-selector {
            margin-bottom: 15px;
        }

        .api-selector select {
            padding: 8px;
            border-radius: 4px;
            border: 1px solid #dcdee2;
            width: 100%;
        }

        .instructions {
            background-color: #f8f8f9;
            padding: 15px;
            border-radius: 4px;
            margin-top: 20px;
            font-size: 14px;
            line-height: 1.6;
        }

        .instructions h3 {
            margin-top: 0;
            color: #2d8cf0;
        }

        .share-section {
            margin-top: 20px;
            text-align: center;
        }

        .share-btn {
            background-color: #19be6b;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            margin-top: 10px;
        }

        @media (min-width: 768px) {
            body {
                padding: 20px;
            }

            .container {
                padding: 20px;
            }

            h1 {
                font-size: 28px;
            }

            .input-group {
                flex-wrap: nowrap;
            }

            .input-group input {
                border-radius: 4px 0 0 4px;
                margin-bottom: 0;
            }

            .input-group button {
                border-radius: 0 4px 4px 0;
                width: auto;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>全网视频-解析工具</h1>

        <div class="api-selector">
            <select id="api-select">
                <option value="https://jx.m3u8.tv/jiexi/?url=">线路1 - VIP解析（推荐）</option>
                <option value="https://jx.xyflv.cc/?url=">线路2 - 勉强能看</option>
                <option value="https://jx.bozrc.com:4433/player/?url=">线路3 - 勉强能看</option>
                <option value="https://jx.playerjy.com/?url=">线路4 - 勉强能看</option>
                <option value="https://www.yemu.xyz/?url=">线路5 - 勉强能看</option>
                <option value="https://jx.aidouer.net/?url=">线路6 - B站专用</option>
            </select>
        </div>

        <div class="input-group">
            <input type="text" id="video-url"
                placeholder="请输入视频链接，支持腾讯、爱奇艺、哔哩哔哩等">
            <button onclick="parseVideo()">解析播放</button>
        </div>

        <div class="player-container">
            <iframe id="video-player" src="" frameborder="0" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe>
        </div>

        <div class="share-section">
            <p>分享此工具给一条鱼</p>
            <button class="share-btn" onclick="shareWebsite()">分享链接</button>
        </div>

        <div class="instructions">
            <h3>使用说明</h3>
            <p>1. 复制视频网页链接，支持以下平台:</p>
            <ul style="padding-left: 20px; margin-top: 5px; margin-bottom: 10px;">
            <li>腾讯视频 (v.qq.com)</li>
            <li>爱奇艺 (iqiyi.com)</li>
            <li>哔哩哔哩 (bilibili.com)</li>
            <li>抖音 (douyin.com)</li>
            <li>快手 (kuaishou.com)等...</li>
            </ul>
            <p>2. 如果当前线路无法播放，请尝试切换其他线路</p>
            <p>3. 开发作者为Xiaoyu_2009（小宇不是鱼）</p>
            <p>4. 本工具仅供学习交流使用，请勿用于商业用途</p>
        </div>
    </div>

    <script>
        function parseVideo() {
            let videoUrl = document.getElementById('video-url').value.trim();
            let apiUrl = document.getElementById('api-select').value;

            if (!videoUrl) {
                alert('请输入视频链接');
                return;
            }

            let extractedUrl = videoUrl;
            const urlMatch = videoUrl.match(/(https?:\/\/[^\s]+)/);
            if (urlMatch && urlMatch[0]) {
                extractedUrl = urlMatch[0];
                videoUrl = extractedUrl;
            }
            
            if (extractedUrl.includes('bilibili.com')) {
                if (document.getElementById('api-select').selectedIndex !== 5) {
                    document.getElementById('api-select').selectedIndex = 5;
                    apiUrl = document.getElementById('api-select').value;
                    alert('检测到B站链接，已自动切换到B站专用解析线路');
                }
            }

            const supportedSites = [
                'v.qq.com',
                'iqiyi.com',
                'youku.com',
                'mgtv.com',
                'tv.sohu.com',
                'bilibili.com',
                '1905.com',
                'pptv.com',
                'douyin.com',
                'kuaishou.com',
                'ixigua.com',
                'haokan.baidu.com'
            ];
            
            let isSupported = false;
            for (const site of supportedSites) {
                if (videoUrl.includes(site)) {
                    isSupported = true;
                    break;
                }
            }
            
            if (!isSupported) {
                alert('请输入支持的视频链接，包括腾讯、爱奇艺、哔哩哔哩等主流视频网站');
                return;
            }

            const player = document.getElementById('video-player');
            player.src = apiUrl + encodeURIComponent(videoUrl);
            
            localStorage.setItem('lastVideoUrl', document.getElementById('video-url').value.trim());
            localStorage.setItem('lastApiUrl', apiUrl);
        }

        function shareWebsite() {
            try {
                const dummy = document.createElement('textarea');
                dummy.style.position = 'fixed';
                dummy.style.left = '0';
                dummy.style.top = '0';
                dummy.style.opacity = '0';
                dummy.value = window.location.href;
                document.body.appendChild(dummy);
                dummy.focus();
                dummy.select();
                document.execCommand('copy');
                document.body.removeChild(dummy);
                setTimeout(function() {
                    alert('网址已复制到剪贴板，您可以分享给一条鱼或者发给朋友！');
                }, 100);
            } catch (e) {
                alert('分享失败，请手动复制网址');
            }
        }

        document.addEventListener('DOMContentLoaded', function () {
            const urlInput = document.getElementById('video-url');
            const apiSelect = document.getElementById('api-select');
            const lastVideoUrl = localStorage.getItem('lastVideoUrl');
            const lastApiUrl = localStorage.getItem('lastApiUrl');
            
            if (lastVideoUrl) {
                urlInput.value = lastVideoUrl;
            }
            
            if (lastApiUrl) {
                for (let i = 0; i < apiSelect.options.length; i++) {
                    if (apiSelect.options[i].value === lastApiUrl) {
                        apiSelect.selectedIndex = i;
                        break;
                    }
                }
            }

            if (navigator.clipboard && navigator.clipboard.readText) {
                navigator.clipboard.readText()
                    .then(text => {
                        if (text && !urlInput.value) {
                            const supportedSites = ['v.qq.com', 'iqiyi.com', 'bilibili.com', 'youku.com', 'mgtv.com'];
                            for (const site of supportedSites) {
                                if (text.includes(site)) {
                                    urlInput.value = text;
                                    break;
                                }
                            }
                        }
                    })
                .catch(err => {});
            }

            const urlParams = new URLSearchParams(window.location.search);
            const urlParam = urlParams.get('url');
            if (urlParam) {
                const decodedUrl = decodeURIComponent(urlParam);
                urlInput.value = decodedUrl;
                const urlParamMatch = decodedUrl.match(/(https?:\/\/[^\s]+)/);
                const extractedParamUrl = urlParamMatch && urlParamMatch[0] ? urlParamMatch[0] : decodedUrl;
                const currentIndex = document.getElementById('api-select').selectedIndex;
                const isBiliSelected = currentIndex === 5;
                
                if (!(extractedParamUrl.includes('bilibili.com') && isBiliSelected)) {
                    parseVideo();
                }
            }
        });
    </script>
</body>

</html> 